package com.ylkj.patient.moduleimpl;

import android.app.Activity;
import android.content.Context;
import android.os.Bundle;

import com.alibaba.android.arouter.facade.annotation.Route;
import com.alibaba.android.arouter.launcher.ARouter;
import com.examination.mlib.constants.ARouterConstants;
import com.users.rn.common.cmbroadcast.RNKITTools;
import com.yljk.mcconfig.constants.MCARouter;
import com.examination.mlib.interfaceapi.MessageCallApi;
import com.ylkj.patient.utils.AppReactUtils;

import java.util.ArrayList;

@Route(path = ARouterConstants.MessageModuleImpl)
public class MessageModuleImpl implements MessageCallApi {

    /**
     * 无参android to rn
     * @param context
     * @param pluginId rn包名
     * @param componentName rn页面名
     */
    @Override
    public void Android2RnPush(Context context, String pluginId, String componentName) {
        AppReactUtils.INSTANCE.push(context,pluginId,componentName);
    }

    /**
     * 带参androi to rn
     * @param context
     * @param pluginId rn包名
     * @param componentName rn页面名
     * @param bundle 参数
     */
    @Override
    public void Android2RnPush(Context context, String pluginId, String componentName, Bundle bundle) {
        AppReactUtils.INSTANCE.push(context,pluginId,componentName,bundle);
    }

    @Override
    public void Android2RnBroadcast(Context context, String eventName, String content) {
        RNKITTools.INSTANCE.sendBroadcast(context,eventName,content);
    }

    @Override
    public void openKefu(ArrayList<String> tel, Context context) {
        AppReactUtils.INSTANCE.openPhoneView((Activity) context, tel);
    }

    @Override
    public void sendBrocast(Context context,String key, String value) {
        RNKITTools.INSTANCE.sendBroadcast(context,key,value);
    }

    @Override
    public void videoCall(String videoId) {
        ARouter.getInstance().build(MCARouter.VIDEO_CALL)
                .withString("videoId", videoId).navigation();
    }

    @Override
    public void init(Context context) {

    }

}
